package com.gusti.admincasa.model;

import java.util.GregorianCalendar;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import com.gusti.admincasa.persistence.model.AbstractModelObject;

/**
 * 
 * @author gusti
 *
 */
@Entity
public class TimeRegister extends AbstractModelObject {

	private String uuid;
	@ManyToOne
	@JoinColumn(name = "userId", nullable = false)
	private User user;
	private String computerName;
	private GregorianCalendar startDate;
	private GregorianCalendar endDate;

	public String getUuid() {
		return uuid;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	@Transient
	public long getUserId() {
		return this.user != null ? this.user.getId() : -1;
	}

	public String getComputerName() {
		return computerName;
	}
	public void setComputerName(String computerName) {
		this.computerName = computerName;
	}

	public GregorianCalendar getStartDate() {
		return startDate;
	}
	public void setStartDate(GregorianCalendar startDate) {
		this.startDate = startDate;
	}

	public GregorianCalendar getEndDate() {
		return endDate;
	}
	public void setEndDate(GregorianCalendar endDate) {
		this.endDate = endDate;
	}
}
